//映射表
const mongoose = require('mongoose')
const Schema = mongoose.Schema//获取数据库对象中的映射表方法

const UserSchema = new Schema(//在映射表示例中写入需要映射的数据
    {
        userId: {
            type: String,
            unique: true,
            require: true
          },
          account: {
            type: String
          },
          userName: {
            type: String
          },
          email: {
            type: String
          },
          phone: {
            type: String
          },
          headerImg: {
            type: String
          },
          studentId: {
            type: String
          },
          school: {
            type: String
          },
          schoolId: {
            type: String
          },
          provinceId: {
            type: Number
          },
          major: {
            type: String
          },
          college: {
            type: String
          },
          wechat: {
            type: String
          },
          qq: {
            type: String
          },
          collections: {
            type: Array
          } 
        
},
{
collection:'user',//需要映射的表名
versionKey:false//关闭版本密钥
}
)

 const user_model = mongoose.model('user',UserSchema)//让schema生效
 module.exports =  user_model